import { createRouter, createWebHistory } from "vue-router";
import type { RouteRecordRaw } from "vue-router";
const routes: RouteRecordRaw[] = [
  {
    path: "/",
    name: "首页",
    meta: {
      keepAlive: true
    },
    component: () => import("@/views/Home/Home.vue")
  },
  {
    path: "/chat",
    name: "聊天室",
    component: () => import("@/views/Chat/Chat.vue")
  },
  {
    path: "/writearticle",
    name: "文章编辑",
    component: () => import("@/views/WriteArticle/WriteArticle.vue")
  },
  {
    path: "/editarticle",
    name: "编辑文章",
    component: () => import("@/views/WriteArticle/WriteArticle.vue")
  },
  {
    path: "/search",
    name: "搜索",
    component: () => import("@/views/Search/Search.vue")
  },
  {
    path: "/readview/:id?",
    name: "文章",
    component: () => import("@/views/ReadView/ReadView.vue")
  },
  {
    path: "/info/:id?",
    name: "个人信息",
    component: () => import("@/views/UserInfo/UserInfo.vue")
  },
  {
    path: "/picture",
    name: "图片墙",
    component: () => import("@/views/Picture/Picture.vue")
  },
  {
    path: "/project",
    name: "项目墙",
    component: () => import("@/views/Project/Project.vue")
  },
  {
    path: "/tag",
    name: "标签",
    component: () => import("@/views/TagArticle/TagArticle.vue")
  }
];
export default createRouter({
  routes,
  history: createWebHistory()
  // scrollBehavior(to, from, savedPosition) {
  //   return { top: 0, y: 0 };
  // }
});
